import SynchronizationLoginNork from '@/utils/SynchronizationLoginWork'
import Synchronization from "@/utils/Synchronization"

export interface ConsumableTableInterface{
    total: 4278,
    dtos:TableInterface[]
}

export interface TableInterface {
    mtlNo: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: null,
    mtlUnit: string,
    inDate: string,
    outDate: string,
    inQty: number,
    outQty: number,
    stockQty: number
}

export  interface  ConsumableParms{
    inEndDate:string,
    inStartDate:string,
    mtlName:string,
    mtlNo:string,
    outEndDate:string,
    outStartDate:string,
    pageNum:number,
    pageSize:number,
    typeNo:string,

}

export const ConsumableInventoryTableData = (parms:ConsumableParms) => {
    return Synchronization.put<any,ConsumableTableInterface>('/pcFactorQuery/queryPartBfStockHead',parms)
}

export interface FindTinterface {
    mtl:[],
    type:ConsumableDropDownBoxType[]
}

interface ConsumableDropDownBoxType{
    typeNo: string,
    typeName: string
}


export const ConsumableInventoryFind = () => {
    return Synchronization.get<any,FindTinterface>('/pcFactorQuery/queryPartBfStockBack')
}

export interface  PcFactorQuery{
    inDetail:inDetail[]
    outDetail:outDetail[]
}

export interface inDetail{
    slipDate: string,
    slipNo: string,
    slipReason: string,
    vendorName: string,
    deptName: null,
    qty: number
}

export interface outDetail{
   slipDate:string,
   slipNo:string,
   slipReason:string,
   vendorName: null,
   deptName:string,
   qty: number
}

export const outPutAndInPutOfWarehouse= (mtlNo:string) => {
    return Synchronization.get<any,PcFactorQuery>(`/pcFactorQuery/queryPartBfStockDetail/${mtlNo}`)
}